/**
 * @description: 配置
 */
import { defHttp } from '../http'
import type { CommonAPI } from '../schema/all'

/** 获取默认节点缓存配置 */
export const getApiConfigDefaultNodeCacheConfigApi: CommonAPI<
  '/api/config/default-node-cache-config',
  'get'
> = (params) => defHttp.get(`/api/config/default-node-cache-config`, { params })

/** 设置默认节点缓存配置 */
export const updateApiConfigDefaultNodeCacheConfigApi: CommonAPI<
  '/api/config/default-node-cache-config',
  'put'
> = (data) => defHttp.put(`/api/config/default-node-cache-config`, { data })

/** 获取 HTTP 监听端口 */
export const getApiConfigHttpPortsApi: CommonAPI<
  '/api/config/http-ports',
  'get'
> = (data) => defHttp.get(`/api/config/http-ports`, { data })

/** 设置 HTTP 监听端口 */
export const updateApiConfigHttpPortsApi: CommonAPI<
  '/api/config/http-ports',
  'put'
> = (data) => defHttp.put(`/api/config/http-ports`, { data })

/** 获取管理端地址 */
export const getApiConfigMgrAddrApi: CommonAPI<
  '/api/config/mgr-addr',
  'get'
> = (params) => defHttp.get(`/api/config/mgr-addr`, { params })

/** 设置管理端地址 */
export const updateApiConfigMgrAddrApi: CommonAPI<
  '/api/config/mgr-addr',
  'put'
> = (data) => defHttp.put(`/api/config/mgr-addr`, { data })

/** 获取预设缓存规则 */
export const getApiConfigPresetCacheRuleApi: CommonAPI<
  '/api/config/preset-cache-rule',
  'get'
> = (params) => defHttp.get(`/api/config/preset-cache-rule`, { params })

/** 设置预设缓存规则 */
export const updateApiConfigPresetCacheRuleApi: CommonAPI<
  '/api/config/preset-cache-rule',
  'put'
> = (data) => defHttp.put(`/api/config/preset-cache-rule`, { data })

/** 获取CDN端口 */
export const getApiConfigCdnPortApi: CommonAPI<
  '/api/config/http-ports',
  'get'
> = (params) => defHttp.get(`/api/config/http-ports`, { params })

/** 设置CDN端口 */
export const updateApiConfigCdnPortApi: CommonAPI<
  '/api/config/http-ports',
  'put'
> = (data) => defHttp.put(`/api/config/http-ports`, { data })
